Bentley Map V8i (SELECTseries 10) Help

Loading Data from ASCII Files Using Scripts

Data located in ASCII files, often separated by commas or semicolons, can by processed directly in a script. Before processing the data, define an ASCII_FORMAT to describe how the data in the file is to be formatted. When ASCII_FORMAT has been defined, the script reads the data from the file and for each data block (normally a line), and a script is called to process the data. The following code shows the syntax for defining an ASCII_FORMAT.



Skip — The number of lines to be skipped in the beginning of the file.

COMMENT – Lines beginning with the given character sequence are interpreted as comment lines. Here, the character is a semicolon.

BLOCK – The number of lines in one data block; normally 1.

SEPARATOR – Gives the character sequence (here, a comma) used for separating the data values in the ASCII file.

LINE – This value tells from which line in the data block the following variables must be read. In the above example with only one line in each data block, the value is one for all variables.

ASSIGN – Lines starting with the keyword ASSIGN define the name and type of the variable to used for each item in the data line.

The syntax for the ASSIGN lines are: ASSIGN variable_name { I | R | S | B } SEPARATOR item_number.

variable_name – The name of the variable in which to store the value.

variable_type – The type for the variable must be I, R, S, or B representing Integers, decimal numbers, Strings or Boolean.

item_number – Item 1 is extracted from the beginning of the line to the first separator. Item 2 if extracted from the first to the second separator, etc.

The following file example “fits” the above ASCII_FORMAT:



The following script file shows how the ASCII_FORMAT is used in combination with a script to process the data: